A daemon thread is a thread, that does not prevent the JVM from exiting when the program finishes but the thread is still running. An example for a daemon thread is the garbage collection.
You can use the setDaemon() method to change the Thread daemon properties.When a new thread is created it inherits the daemon status of its parent.
Normal thread and daemon threads differ in what happens when they exit. When the JVM halts any remaining daemon threads are abandoned:
finally blocks are not executed,
stacks are not unwound - the JVM just exits.
Due to this reason daemon threads should be used sparingly and it is dangerous to use them for tasks that might perform any sort of I/O.
Liked By
Write Answer
What is Daemon thread in java
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
03-Sep-2015